/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;





class image_des_num extends JWindow
{
    public image_des_num(String nom_du_fichier, int Pause)
    {
        
        JLabel l = new JLabel(new ImageIcon(nom_du_fichier));
        getContentPane().add(l, BorderLayout.CENTER);
        pack();
        
        //pour mettre la photo en milieu...
        Dimension screenSize =
          Toolkit.getDefaultToolkit().getScreenSize();
        Dimension labelSize = l.getPreferredSize();
        setLocation(screenSize.width/2 - (labelSize.width/2),
                    screenSize.height/2 - (labelSize.height/2));
       // la photo va disparaitre apres ce (int Pause) mS
        final int pause = Pause;
        final Runnable closerRunner = new Runnable()
            {
                public void run()
                {
                    setVisible(false);
                    dispose();
                }
            };
        Runnable waitRunner = new Runnable()
            {
                public void run()
                {
                    try
                        {
                            Thread.sleep(pause);
                            SwingUtilities.invokeAndWait(closerRunner);
                        }
                    catch(Exception e)
                        {
                            e.printStackTrace();
                            
                        }
                }
            };
        setVisible(true);
        Thread splashThread = new Thread(waitRunner, "Fenetre");
        splashThread.start();
    }
}


